﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.XPath;

namespace Transformer.iHunter
{
    /// <summary>
    /// The interface for message editor control to exchange data to other components
    /// </summary>
    public interface IMessageEditor
    {
        /// <summary>
        /// Gets the final message. 
        /// If the message is not a valid one, the error information will be shown and <c>null</c> is returned.
        /// </summary>
        /// <returns>The message object, or <c>null</c> if validation fails</returns>
        IMessage GetMessage();

        /// <summary>
        /// Gets the draft message, without validating.
        /// </summary>
        /// <returns>The draft message</returns>
        IMessage GetDraft();

        /// <summary>
        /// Imports an existing message to the editor.
        /// </summary>
        /// <param name="source">The source message.</param>
        /// <returns>
        /// 	<c>true</c> if the message is a valid one, <c>false</c> if validation fails
        /// </returns>
        bool ImportMessage(IMessage source);

        /// <summary>
        /// Gets a value indicating whether the message is modified since imported or created.
        /// </summary>
        /// <value><c>true</c> if modified; otherwise, <c>false</c>.</value>
        bool MessageModified { get; set; }

        /// <summary>
        /// Gets a value indicating whether the message is valid.
        /// </summary>
        /// <value><c>true</c> if valid; otherwise, <c>false</c>.</value>
        bool MessageValid { get; }


        /// <summary>
        /// Gets the contextual commands.
        /// </summary>
        /// <value>The contextual commands. or <c>null</c> if contextual commands is not needed</value>
        /// <remarks>
        /// Using an XML document to describe the contextual commands.
        /// The contextual commands will be displayed when a message associated with this channel provider
        /// (means the messages is created by a channel that created by this provider) is selected and opened.
        /// The style of displaying the command UI elements depends on the GUI.
        /// For example, The Ribbon GUI will display these commands and a contextual ribbon tab in the command bar.
        /// </remarks>
        XPathNavigator ContextualCommands { get; }

        void ExcuteCommand(CommandUIEventArgs uiElement);
       
        event CommandUIEventHandler UpdateCommandUI;
    }
}
